import * as actionType from "./constants.js";
import { reqmovie } from "../../../api/index";

//电影movie页面数据
export const changeMovieData = (data) => {
  return {
    type: actionType.CHANGE_MOVIEDATA,
    data: data,
  };
};

export const getMovieData = () => {
  return (dispatch) => {
    reqmovie()
      .then((res) => {
        dispatch(changeMovieData(res.data.data));
      })
      .catch((e) => {
        console.log("出错了");
      });
  };
};


export const changeIndex = (data) => {
  return {
      type: actionType.CHANGE_INDEX,
      data: data,
  }
}
